﻿//************************************************************************************************
// Copyright © 2014 Steven M. Cohn. All Rights Reserved.
// 
//************************************************************************************************

namespace River.Folderize.UI
{
	using System;
	using System.Diagnostics;
	using System.Reflection;
	using System.Windows.Controls;
	using System.Windows.Navigation;


	/// <summary>
	/// Interaction logic for AboutPanel.xaml
	/// </summary>
	
	public partial class AboutPanel : UserControl
	{
		public AboutPanel ()
		{
			InitializeComponent();

			Assembly assembly = Assembly.GetExecutingAssembly();
			Version version = assembly.GetName().Version;
			versionText.Text = version.ToString();

			// convert a days since 1/1/2000 to an actual date
			var start = new DateTime(2000, 1, 1);
			dateText.Text = start.AddDays(version.Revision).ToString("d MMM yyyy");

			var copy = 2014;
			var year = DateTime.Now.Year;
			copyText.Text = (copy == year ? copy.ToString() : copy + "-" + year);
		}


		private void NavigateToURL (object sender, RequestNavigateEventArgs e)
		{
			Process.Start(new ProcessStartInfo(e.Uri.AbsoluteUri));

			e.Handled = true;
		}
	}
}
